package com.iwhalecloud.bss.kite.cucc.service.attr.linkhandler;

import com.iwhalecloud.bss.kite.common.constant.KeyConsts;
import com.iwhalecloud.bss.kite.common.util.KiteStringUtils;
import com.iwhalecloud.bss.kite.cucc.service.attr.handler.GlowedNodeServiceAttrHandler;
import com.iwhalecloud.bss.kite.listener.handler.attr.annotation.AttrHandler;
import com.iwhalecloud.bss.kite.listener.handler.attr.impl.AbstractAttrLinkageHandler;
import com.iwhalecloud.bss.kite.manager.api.IQuerySceneInstService;
import com.iwhalecloud.bss.kite.manager.inst.KiteAttr;
import com.iwhalecloud.bss.kite.manager.inst.KiteInst;
import com.iwhalecloud.bss.kite.service.attr.AttrData;
import com.iwhalecloud.bss.kite.service.scene.attr.OperateInstAttrService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * @author zhoubang
 * 云聚节点--属性联动属性联动
 */
@Service
@AttrHandler(GlowedNodeServiceAttrHandler.class)
public class GlowedNodeServiceAttrLinkHandler extends AbstractAttrLinkageHandler<AttrData> {
    @Autowired
    IQuerySceneInstService querySceneInstService;

    @Autowired
    OperateInstAttrService operateInstAttrService;

    @Override
    public void handle(KiteAttr kiteAttr, KiteInst kiteInst, AttrData data) {
        if(KiteStringUtils.equals(kiteAttr.getValue(), "100006211")||KiteStringUtils.equals(kiteAttr.getValue(), "100006212")){
            //销售模式选择“云商直签“和”云商引流“展示，必填；
            kiteInst.getAttr("200003568").setShowType(KeyConsts.PROD_ATTR_SHOW_TYPE_D);
            kiteInst.getAttr("200003568").setIsNull(KeyConsts.IFTRUE_F);;
            kiteInst.getAttr("2_0000019").setShowType(KeyConsts.PROD_ATTR_SHOW_TYPE_H);
        }else if(KiteStringUtils.equals(kiteAttr.getValue(), "100006209")||KiteStringUtils.equals(kiteAttr.getValue(), "100006210")){
            //销售模式选择“运营商直签“和”运营商引流“展示，必填；
            kiteInst.getAttr("2_0000019").setShowType(KeyConsts.PROD_ATTR_SHOW_TYPE_D);
            kiteInst.getAttr("2_0000019").setIsNull(KeyConsts.IFTRUE_F);;
            kiteInst.getAttr("200003568").setShowType(KeyConsts.PROD_ATTR_SHOW_TYPE_H);
        }else if(KiteStringUtils.equals(kiteAttr.getValue(), "100006213")){
            //销售模式选择联通直签
            kiteInst.getAttr("2_0000019").setShowType(KeyConsts.PROD_ATTR_SHOW_TYPE_H);
            kiteInst.getAttr("200003568").setShowType(KeyConsts.PROD_ATTR_SHOW_TYPE_H);
        }
    }

    @Override
    public void handleStyle(KiteAttr kiteAttr, KiteInst kiteInst, AttrData data) {

    }
}
